package vsvm.math;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

public class Point {

	public double x = 0;
	public double y = 0;
	
	public Point(double x, double y) {
		this.x = x; this.y = y;
	}
	
	public static void sortByX(ArrayList <Point> list) {
		Collections.sort(list, new Comparator <Point>() {
			public int compare(Point p1, Point p2){
				if (Math.abs(p1.x - p2.x) < CoreMath.EPS) return 0;				
				if (p1.x < p2.x) return -1;
				return 1;
			}
		});
	}
	
	public static void sortByY(ArrayList <Point> list) {
		Collections.sort(list, new Comparator <Point>() {
			public int compare(Point p1, Point p2){
				if (Math.abs(p1.y - p2.y) < CoreMath.EPS) return 0;				
				if (p1.y < p2.y) return -1;
				return 1;
			}
		});
	}
}
